@keyframes swing {
  0% {
    transform: rotate(0deg);
  }

  10% {
    transform: rotate(10deg);
  }

  30% {
    transform: rotate(0deg);
  }

  40% {
    transform: rotate(-10deg);
  }

  50% {
    transform: rotate(0deg);
  }

  60% {
    transform: rotate(5deg);
  }

  70% {
    transform: rotate(0deg);
  }

  80% {
    transform: rotate(-5deg);
  }

  100% {
    transform: rotate(0deg);
  }
}

@keyframes sonar {
  0% {
    transform: scale(0.9);
    opacity: 1;
  }

  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.st-sidebar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  transition: left 0.3s ease;
  //
  &.toggled {
    left: -240px;
  }

  //
  a {
    text-decoration: none;
    transition: color 0.3s ease;
  }

  //
  &_main {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    position: relative;
  }
  //
  &_header {
    display: flex;
    justify-content: start;
    align-content: center;
    padding: 10px 14px 10px 20px;

    > a {
      text-transform: uppercase;
      font-weight: bold;
      text-decoration: none;
      flex: 1;
      line-height: 20px;
      margin-right: 20px;
    }
    > i {
      cursor: pointer;
      line-height: 20px;
    }
  }
  &_menu {
    // 最上级
    .header-menu span {
      font-weight: bold;
      font-size: 14px;
      padding: 15px 20px 5px 20px;
      display: inline-block;
    }
    //
    ul {
      list-style-type: none;
      padding: 0;
      margin: 0;

      li a {
        display: inline-block;
        width: 100%;
        text-decoration: none;
        position: relative;
        padding: 8px 30px 8px 20px;

        i {
          margin-right: 10px;
          font-size: 12px;
          width: 30px;
          height: 30px;
          line-height: 30px;
          text-align: center;
          border-radius: 4px;
        }

        &:hover > i::before {
          display: inline-block;
          animation: swing ease-in-out 0.5s 1 alternate;
        }

        span.label,
        span.badge {
          float: right;
          margin-top: 8px;
          margin-left: 5px;
        }
      }
    }
    //菜单
    .sidebar-dropdown {
      &.active > a:after {
        transform: rotate(90deg);
        right: 15px;
      }

      > a:after {
        font-family: 'Font Awesome 5 Free';
        font-weight: 900;
        content: '\f105';
        display: inline-block;
        font-style: normal;
        font-variant: normal;
        text-rendering: auto;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-align: center;
        background: 0 0;
        position: absolute;
        right: 15px;
        top: 14px;
        transition: transform 0.3s ease;
      }

      // 子菜单
      .sidebar-submenu {
        // display: none;
        overflow: hidden;

        ul {
          padding: 5px 0;
        }

        li {
          padding-left: 25px;
          font-size: 13px;

          &.active a:before {
            font-weight: 900;
          }

          a {
            &:before {
              content: '\f111';
              font-family: 'Font Awesome 5 Free';
              font-weight: 400;
              font-style: normal;
              display: inline-block;
              text-align: center;
              text-decoration: none;
              -webkit-font-smoothing: antialiased;
              -moz-osx-font-smoothing: grayscale;
              margin-right: 10px;
              font-size: 8px;
            }

            .badge,
            .label {
              float: right;
              margin-top: 0px;
            }
          }
        }
      }
    }
  }
}

/*default theme*/
$bg-sidebar: #1d1d1d;
$border-color: #2b2b2b;
$color: #bdbdbd;
$hover-color: #ffffff;
$header-menu-color: #6c7b88;

// colors with backgound image
$img-bg-sidebar-wrapper: rgba(29, 29, 29, 0.8);
$img-border-color: rgba(255, 255, 255, 0.1);
$img-bg-footer: rgba(43, 43, 43, 0.5);
$img-shadow-color: rgba(0, 0, 0, 0.5);

//
.st-sidebar {
  background-color: $bg-sidebar;
  //
  &_menu {
    border-top: 1px solid $border-color;
  }
  //
  .st-sidebar_header a,
  .st-sidebar_header i,
  .st-sidebar_menu ul li a {
    color: $color;
  }
  //
  .st-sidebar_menu ul li:hover > a,
  .st-sidebar_header > a:hover,
  .st-sidebar_menu .sidebar-dropdown.active > a,
  .st-sidebar_menu .sidebar-submenu .active > a {
    color: $hover-color;
  }

  //
  ul li:hover a i,
  .st-sidebar_menu .sidebar-submenu li a:hover:before,
  .st-sidebar_menu .sidebar-dropdown.active a i,
  .st-sidebar_menu .sidebar-submenu .active a i {
    color: $hover-color;
  }
  //
  .st-sidebar_menu ul li a i,
  .st-sidebar_menu .sidebar-dropdown div {
    background-color: $border-color;
    border: none;
    margin-left: 1px;
  }
  //
  .st-sidebar_menu .header-menu span {
    color: $header-menu-color;
  }

  //bg
  &.sidebar-bg {
    background-image: url(/assets/img/bg-sidebar.jpg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    //
    &:before {
      content: '';
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      background-color: $img-bg-sidebar-wrapper;
    }
    //
    .st-sidebar_menu {
      border-top: 1px solid $img-border-color;
    }
    //
    .st-sidebar_menu ul li a i,
    .st-sidebar_menu .sidebar-dropdown div {
      background-color: $img-border-color;
    }
  }
}
